package com.ifeng.shopping.util;

/**
 *  数据结构对象
 * @author xunhuani
 *
 */
public class ParamStruct
{
	public int user_id;     //用户Id
	public int width_image;	 //图片宽度
	public int height_image; //图片高度
	public int width_real;	 //屏幕实际宽度
	public int height_real;	 //屏幕实际高度
	public int good_stype_id;  //商品类型ID
	public int id_set;	    //套题Id
	public int sort;        //次序
	public int id_sector;   //版块ID
	public int id_secondSector;//二级板块ID
	
	public ParamStruct()
	{}
	public void ConvertFromString(String strStruct)
	{
		String[] strsStruct= strStruct.split(",");
		int[] intsStruct=new int[strsStruct.length];
		for(int i=0;i<strsStruct.length;i++)
		{
			intsStruct[i]=Integer.parseInt(strsStruct[i]);
		}
		ConvertToStruct(intsStruct);
	}
	public String ConvertToString()
	{
		int[] intsStruct=ConvertToArray();
		String strStruct="";
		for(int i=0;i<intsStruct.length;i++)
		{
			strStruct+=intsStruct[i]+",";
		}
		if(strStruct.length()>0){
			strStruct=strStruct.substring(0,strStruct.length()-1);
			return strStruct;
		}else
			return null;
		
	}
	
    public int[] ConvertToArray()
    {
    	int[] a=new int[10];
    	a[0]=this.user_id;
    	a[1]=this.width_image;
    	a[2]=this.height_image;
    	a[3]=this.width_real;
    	a[4]=this.height_real;
    	a[5]=this.good_stype_id;
    	a[6]=this.id_set;
        a[7]=this.sort;
        a[8]=this.id_sector;
        a[9]=this.id_secondSector;
    	return a;
    }
    public void ConvertToStruct(int[] a)
    {
    	this.user_id=a[0];
    	this.width_image=a[1];
    	this.height_image=a[2];
    	this.width_real=a[3];
    	this.height_real=a[4];
    	this.good_stype_id=a[5];
    	this.id_set=a[6];
    	this.sort=a[7];
    	this.id_sector=a[8];
    	this.id_secondSector=a[9];
    }
	
	public int getUser_id() {
		return user_id;
	}
	public void setUser_id(int userId) {
		user_id = userId;
	}
	public int getWidth_image() {
		return width_image;
	}
	public void setWidth_image(int widthImage) {
		width_image = widthImage;
	}
	public int getHeight_image() {
		return height_image;
	}
	public void setHeight_image(int heightImage) {
		height_image = heightImage;
	}
	public int getWidth_real() {
		return width_real;
	}
	public void setWidth_real(int widthReal) {
		width_real = widthReal;
	}
	public int getHeight_real() {
		return height_real;
	}
	public void setHeight_real(int heightReal) {
		height_real = heightReal;
	}
	public int getId_set() {
		return id_set;
	}
	public void setId_set(int idSet) {
		id_set = idSet;
	}
	public int getSort() {
		return sort;
	}
	public void setSort(int sort) {
		this.sort = sort;
	}
	public int getId_sector() {
		return id_sector;
	}
	public void setId_sector(int idSector) {
		id_sector = idSector;
	}
	public int getId_secondSector() {
		return id_secondSector;
	}
	public void setId_secondSector(int idSecondSector) {
		id_secondSector = idSecondSector;
	}
	public int getGood_stype_id() {
		return good_stype_id;
	}
	public void setGood_stype_id(int goodStypeId) {
		good_stype_id = goodStypeId;
	}
	
}